package org.csu.demo.persistence;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.csu.demo.domain.Product;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ProductMapper extends BaseMapper<Product> {

    @Select("SELECT PRODUCTID, NAME, DESCN as description, CATEGORY FROM PRODUCT WHERE lower(name) like lower(#{key}) AND DELETED=0")
    List<Product> searchProducts(@Param("key") String key);
}
